<%-- Created by IntelliJ IDEA. --%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<html>
<head>
    <title>生活日志</title>
</head>
<body>
<%--页眉--%>
<jsp:include page="/layoutHeader.jsp"/>

<h1>生活日志系统</h1>
<form action="home" method="get">
    <input name="a" value="search" type="hidden">
    <input name="search">&nbsp;&nbsp;&nbsp;&nbsp;
    <button type="submit">搜索</button>
    <span style="margin-left: 30%">总文章数：${count}</span>
</form>
<hr>
<h2>最近文章</h2>
<c:forEach items="${list}" var="v">
    <a href="article?a=details&id=${v.id}">${v.createTime}
        &nbsp;&nbsp;&nbsp;&nbsp;${v.title}
    </a><br><br>
</c:forEach>
<script>
  var href = window.location.href
  if (href.indexOf("home") == -1) {
    window.location.href = '<%=request.getContextPath()%>/home'
  }
</script>
</body>
</html>
